home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / falcon / nt_dsp2.lzh / NT_DSP2.MSA / BENCH / 6-56.ASM < prev    next >
Encoding:
Assembly Source File  |  1988-07-18  |  2.8 KB  |  90 lines

  1.     page 132,66,0,6
  2.     opt    rc
  3. ;*******************************************
  4. ;Motorola Austin DSP Operation  June 30,1988
  5. ;*******************************************
  6. ;DSP56000/1
  7. ;8 pole cascaded transposed IIR filter
  8. ;File name: 6-56.asm
  9. ;**************************************************************************
  10. ;    Maximum sample rate: 292.9 Khz at 20.5 MHZ/ 385.7 KHz at 27.0 MHz
  11. ;    Memory Size: Prog: 9+11 words ; Data :4(2+5)=28 words
  12. ;    Number of clock cycles:    70 (35 instruction cycles)
  13. ;    Clock Frequency:    20.5MHz/27.0MHz
  14. ;    Cycle time:        97.5ns /  74.1ns
  15. ;**************************************************************************
  16. ;    This IIR filter reads the input sample
  17. ;    from the memory location Y:input
  18. ;    and writes the filtered output sample
  19. ;    to the memory location Y:output
  20. ;
  21. ;    The samples are stored in the X memory
  22. ;    The coefficients are stored in the Y memory
  23. ;**************************************************************************
  24. ;    initialization
  25. ;**********************
  26. nsec    equ    4
  27. start    equ    $40
  28. wdd1    equ     0    ;w1,...
  29. wdd2    equ     8    ;w2,...
  30. cddr    equ     0    ;b0,b1,a1,b2,a2
  31. input    equ    $ffe0
  32. output    equ    $ffe1
  33.  
  34. ;The filter equations are:
  35. ;    y  = x*bi0 + w1
  36. ;    w1 = x*bi1 + y*ai1 + w2
  37. ;    w2 = x*bi2 + y*a2
  38. ;
  39. ;   x  --------------bi0---->(+)--------------------> y
  40. ;               |             ^            |
  41. ;               |             | w1         |
  42. ;               |            1/z           |
  43. ;               |             |            |
  44. ;               |----bi1---->(+)<---ai1----|
  45. ;               |             ^            |
  46. ;               |             | w2         |                                
  47. ;               |            1/z           |
  48. ;               |             |            |
  49. ;               |----bi2---->(+)<---ai2----|
  50. ;
  51. ;    Implemented in that way:
  52. ;
  53. ;    y/2 = bi0/2*x +w1/2
  54. ;    w1/2= bi1/2*x -ai1/2*y +w2/2
  55. ;    w2/2= bi2/2*x -ai2/2*y
  56. ;
  57. ;    r0 -> X:xddr->w1
  58. ;    r1 -> x:addr->w2
  59. ;    r4 -> Y:cddr 
  60. ;
  61.     org    p:start
  62.     move     #wdd1,r0    ;r0 -> w1
  63.     move    #wdd2,r1    ;r1 -> w2
  64.     move    #cddr,r4    ;r4 -> coefficients
  65.     move    #nsec-1,m0
  66.     move    m0,m1
  67.     move    #5*nsec-1,m4
  68. ;
  69.     ori    #$08,mr                ;set scaling mode
  70.     move    x:(r0),a    y:(r4)+,y0    ;a=w1;b=b0/2
  71.     asr    a                ;a=w1/2
  72. ;
  73.     opt    cc
  74. ;    filter loop: 7*nsec+7
  75. ;**********************************************
  76.     movep     y:input,y1            ;input sample in y1
  77. ;    
  78.     do    #nsec,filt
  79.     macr    y1,y0,a    x:(r1),b  y:(r4)+,y0    ;a=y/2=x*bi0/2+w1/2;get w2,bi1/2
  80.     asr    b    a,x0              ;b=w2/2; move y/2 to x0=y
  81.     mac    y1,y0,b          y:(r4)+,y0    ;b=x*bi1/2+w2/2 ,get ai1/2
  82.     macr    x0,y0,b          y:(r4)+,y0    ;b=b+y*ai1/2=w1/2, get bi2/2        
  83.     mpy    y1,y0,b    b,x:(r0)+ y:(r4)+,y0    ;b=x*bi2/2, save w1, get ai2/2
  84.     macr    x0,y0,b    x:(r0),a  a,y1        ;b=b+y*ai2/2=w2, get w1 ,y1=y
  85.     asr    a    b,x:(r1)+ y:(r4)+,y0    ;a=w1/2, save w2, get b(i+1)0
  86. filt
  87.     movep    y1,y:output            ;output sample
  88. ;***********************************************
  89.     end
  90.